#pragma once
#include "OgreEntity.h"
#include "Trigger.h"

class ControlContext;
class Controller;
class ControlLogic;
class PhysicsEntity;
class Trigger;

class EntityControl :
	public Ogre::Entity
{
	Controller* controller;

	PhysicsEntity* bulletActor;
	Ogre::Entity* modelEntity;

	float HitPoint;

	std::vector<Trigger*> TriggerList;

public:
	//EntityControl(void);
	//EntityControl(const Ogre::Entity&, float hp=100);
	EntityControl(float hp=50);
	EntityControl(const Ogre::Entity&, float hp=50);

	void makeController(ControlLogic*);

	Controller* control(const ControlContext&);

	/// Renders the entity as seen from a given camera in a given role.
	//void render(const RenderContext& context);
	/// Updates time-varying entity properties.
	//void animate(double dt);

	~EntityControl(void);

	PhysicsEntity* getPhysicsActor();
	Ogre::Entity* getModelActor();
	void setPhysicsActor(PhysicsEntity*);
	void setModelActor(Ogre::Entity*);

	void AddTrigger(Trigger *trigger);

	//Lowers the hitpoints with the given damage and kills himself if hitpoints go under 0
	void causeDamage(float fmg);

	Ogre::Vector3 getPosition();

	Controller* getController();

};
